﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Transactions;
using System.Data;
using System.Data.Common;

namespace Core
{
    public partial class Aspnet_UsersInRole
    {
        public static void Create(Guid userId, Guid roleId, DataAccessDataContext db)
        {
            db.Aspnet_UsersInRoles.InsertOnSubmit(new Aspnet_UsersInRole { RoleId = roleId, UserId = userId });
        }

        public static void Delete(Guid userId, DataAccessDataContext db)
        {
            IQueryable<Aspnet_UsersInRole> usersInRoleToDelete = from uir in db.Aspnet_UsersInRoles
                                                                 where uir.UserId == userId
                                                                 select uir;
            db.Aspnet_UsersInRoles.DeleteAllOnSubmit(usersInRoleToDelete);
        }
    }
}
